package com.neuedu.yyzx.service.impl;

import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
import com.neuedu.yyzx.entity.NurseContent;
import com.neuedu.yyzx.mapper.NurseContentMapper;
import com.neuedu.yyzx.service.INurseContentService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.stereotype.Service;

/**
 * <p>
 * 护理内容 服务实现类
 * </p>
 *
 * @author dya
 * @since 2021-04-27
 */
@Service
public class NurseContentServiceImpl extends ServiceImpl<NurseContentMapper, NurseContent> implements INurseContentService {
    public boolean updateAll(NurseContent nurseContent) {
        UpdateWrapper updateWrapper = new UpdateWrapper();
        updateWrapper.set("content_name", nurseContent.getContentName());
        updateWrapper.set("content_price", nurseContent.getContentPrice());
        updateWrapper.set("content_ndesc", nurseContent.getContentNdesc());
        if(nurseContent.getIsAdd()!=null){
            updateWrapper.set("is_add",  nurseContent.getIsAdd());
        }
        if (nurseContent.getStatus()!=null){

            updateWrapper.set("status", nurseContent.getStatus());
        }


        updateWrapper.eq("content_id", nurseContent.getContentId());

        int success = getBaseMapper().update(nurseContent, updateWrapper);

        return success>0;
    }
}
